package handler

import (
	"github.com/gin-gonic/gin"
	"good/api/request"
	"good/consts"
	"good/internal/queue"
)

func AllAdmin(c *gin.Context) {
	var req request.AllAdminReq
	if err := c.ShouldBind(&req); err != nil {
		c.JSON(200, gin.H{
			"code": 500,
			"msg":  "查询失败",
			"data": err.Error(),
		})
		return
	}
	for _, onlineConn := range OnlineUser {

		WSRespSuccess(onlineConn, req.Message)
		queue.PublishPub(consts.SEND_GROUP, req.Message)
	}
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "发送成功",
		"data": true,
	})
}
